import {formatDate} from "@/utils/common"
import {fileDelete} from "@/api/strategy/file"

export const columns = [ // 进程策略
    {
        title: '文件名',
        dataIndex: 'originalname',
        key: 'originalname'
    },
    {
        title: '上传时间',
        key: 'uploadtime',
        slots: {
            customRender: 'uploadtime',
        },
        slotsType: 'format',
        slotsFunc: formatDate
    },
    {
        title: '操作',
        key: 'action',
        width: 200,
        slots: {
            customRender: 'action'
        },
        actions: [
            {
                type: 'popconfirm', // 控制类型，默认为a,可选： select | button | a
                key: 'fileid', // 删除的依据，如果需要根据多个字段删除，则字段之间以英文逗号分隔开，例如： id, name
                text: '删除',
                permission: 'file:delete',
                props: {
                  type: 'danger'
                },
                func: async ({record}, callback) =>  {
                    await fileDelete({fileids: [record.fileid]})
                    callback()
                },
            }
        ]
    },
]
